﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using sydfdl.TMS.BLL;
using sydfdl.TMS.Tool;
using System.Data;
using System.Web.Mvc;
using System.IO;
using System.Web;
using System.Xml.Linq;

namespace sydfdl.TMS.UtilityHelp
{
    public class ReadXmlHelp
    {
        /// <summary>
        /// XML根据Key查询Value
        /// </summary>
        /// <param name="category">种类</param>
        /// <param name="key">键</param>
        /// <returns>值</returns>
        public string RetrieveNodeValueByKey(string category, string key)
        {
            string value = string.Empty;
            //try
            //{
            //    XmlDocument xmlDoc = new XmlDocument();
            //    string path = HttpRuntime.AppDomainAppPath.ToString();

            //    xmlDoc.Load(path + @"\XML\config.xml");

            //    XmlNode xmlNode = xmlDoc.SelectSingleNode(category);

            //    if (xmlNode == null)
            //    {
            //        value = string.Empty;
            //    }
            //    else
            //    {
            //        value = xmlNode.SelectSingleNode(key) == null ? string.Empty : xmlNode.SelectSingleNode(key).InnerText.Trim();
            //    }
            //}
            //catch (Exception ex)
            //{
            //    value = string.Empty;
            //}

            return value;
        }
    }
}
